//package com.kungfuhacking.wristbandpro.my.presenter;
//
//import com.alibaba.fastjson.JSONObject;
//import com.kungfuhacking.wristbandpro.base.bean.Basebean;
//import com.kungfuhacking.wristbandpro.base.bean.RequestBean;
//import com.kungfuhacking.wristbandpro.base.presenter.BasePresenter;
//import com.kungfuhacking.wristbandpro.login.activity.LoginActivity;
//import com.kungfuhacking.wristbandpro.my.bean.Family;
//import com.kungfuhacking.wristbandpro.my.bean.FamilyData;
//import com.kungfuhacking.wristbandpro.my.view.IFamilyNumsView;
//import com.kungfuhacking.wristbandpro.net.BaseNoTObserver;
//import com.kungfuhacking.wristbandpro.net.BaseObserver;
//import com.kungfuhacking.wristbandpro.net.RetrofitHttpUtil;
//
//import java.util.ArrayList;
//
//import io.reactivex.disposables.Disposable;
//
///**
// * Created by Aaron on 17/6/2.
// */
//
//public class IFamilyNumsPresenter implements BasePresenter {
//
//    private IFamilyNumsView iFamilyNumsView;
//    private String TAG = getClass().getSimpleName();
//
//    public IFamilyNumsPresenter(IFamilyNumsView iFamilyNumsView) {
//        this.iFamilyNumsView = iFamilyNumsView;
//    }
//
//    public void familyInfo(String childID) {
//
//        JSONObject j = new JSONObject();
//        j.put("token", iFamilyNumsView.getToken());
//        j.put("id", childID);
//
//        RetrofitHttpUtil.getInstance().getOldFamilyInfo(new BaseObserver<FamilyData>() {
//            @Override
//            public void onHandleSuccess(FamilyData familyData) {
//                iFamilyNumsView.setAdapterData(familyData);
//            }
//
//            @Override
//            public void onHandleError(String message) {
//
//            }
//
//            @Override
//            public void onReLogin(String message) {
//                iFamilyNumsView.hideLoading();
//                iFamilyNumsView.showErr(message);
//                iFamilyNumsView.nextActivity(LoginActivity.class);
//            }
//
//            @Override
//            public void onSubscribe(Disposable d) {
//
//            }
//        }, new RequestBean().setData(j.toString()));
//
//    }
//
//
//    /**
//     * 更新家庭信息
//     *
//     * @param address      地址
//     * @param houseType    房产情况
//     * @param hukouAddress 户口地址
//     * @param hukouType    户口类型
//     */
//    public void updateFamilyInfo(final String address, final String houseType, final String hukouType, final String hukouAddress, final ArrayList<Family> families, String childID) {
//
//        FamilyData updateFamily = new FamilyData();
//        updateFamily.setToken(iFamilyNumsView.getToken());
//        updateFamily.setAddress(address);
//        updateFamily.setHouseType(houseType);
//        updateFamily.setHukouType(hukouType);
//        updateFamily.setHukouAddress(hukouAddress);
//        updateFamily.setId(childID);
//
////        if (families == null)
////            updateFamily.setFamily(new ArrayList<Family>());
////        else
//            updateFamily.setFamily(families);
//
////        for (int i = 0; i < updateFamily.getFamily().size() ;i++) {
////            Log.e(TAG, "更新的family :"  + updateFamily.getFamily().get(i).getName() );
////        }
//
//        RetrofitHttpUtil.getInstance().updateOldFamilyInfo(new BaseNoTObserver<Basebean>() {
//            @Override
//            public void onHandleSuccess(Basebean basebean) {
////                iFamilyNumsView.showErr("更新成功");
//                iFamilyNumsView.setBottomInfo(address, houseType, hukouType, hukouAddress, families);
//            }
//
//            @Override
//            public void onHandleError(String message) {
//                iFamilyNumsView.showErr(message);
//            }
//
//            @Override
//            public void onSubscribe(Disposable d) {
//
//                compositeDisposable.add(d);
//            }
//        }, new RequestBean().setData(JSONObject.toJSONString(updateFamily)));
//
//    }
//
//
//    @Override
//    public void clearRequest() {
//        compositeDisposable.clear();
//    }
//}
